import React from 'react'
import ReactDOM from 'react-dom'
// 在react的  react-redux 高阶组件里就是装饰器

function connect(mapStateToProps: any, mapDispatchToProps: any) {
  return function (Target: any) {
    return class extends React.Component {
      render() {
        console.log('WrappedTarget render')
        return <Target />
      }
    }
  }
}

const mapStateToProps = (state: any) => state
const mapDispatchToProps = (dispatch: any) => ({})
@connect(mapStateToProps, mapDispatchToProps)
class App extends React.Component {
  render() {
    return <div>App</div>
  }
}
ReactDOM.render(<App />, document.getElementById('root'))
